/**
 * vue 指令
 * @author xhcss.com
 */
import type { App, Directive } from 'vue'
import { setuploadmoressionDirective } from './loadmore/loadmore'
import { setupDraggableDirective } from './draggable/draggable'


import {setupHighlightDirective} from './highlight/highlight'
/**
 * 此方法使用方法
 * import { setupLoadmore } from './directives'
 * const app = createApp(App);
 * setupLoadmore(app)
 */


/**
 * 导出指令：v-xxx
 * @methods loadmore 滚动底部加载更多，用法: v-loadmore
 */
export const setupLoadmore = (app: App<Element>) => {
    setuploadmoressionDirective(app)
}

/**
 * 拖动指令 
 * v-draggable  拖动当前的dom
 * v-draggable=el 拖动指定的dom
 * v-nodraggable 不能拖动，比如外层能拖动，但是内层不需要拖动，则可以添加这个
 * @param app 
 */
export const setupDraggable = (app: App<Element>) => {
    setupDraggableDirective(app)
}




export const setupHighlight = (app: App<Element>) => {
    setupHighlightDirective(app)
}






/**
 * 若是想要批量直接导入，则使用此方法
 * import directives from '@/directives'
 * app.use(directives)
 */
// import loadmoreDirective from './loadmore/loadmore'
// const directivesList:Record<string,Directive> = {
//     loadmoreDirective
// };
// const directives = {
//     install: function (app: App<Element>) {
//         Object.keys(directivesList).forEach(key => {
//             // 注册自定义指令
//             app.directive(key, directivesList[key]);
//         });
//     }
// };


// export default directives;

